<template>
	<view class="u-page">
		<view class="header">
		
		</view>
		
		<view class="content" >
			<view class="message" v-for="(item,key) in list" :key="key">
				<view class="lable">
					<view class="title" v-if="type == 0">系统消息</view>
					<view class="title" v-if="type == 1">项目消息</view>
					<view class="title" v-if="type == 2">余额变动消息</view>
					<view class="time">{{item.createtime}}</view>
				</view>
				<view class="post">{{item.message}}</view>
			</view>
		</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				userData:{},
				title:'',
				type:'',
				list:[]
			}
			
		},
		onLoad(option) {
			
			let user = uni.getStorageSync('userData');
			this.userData = user;
			this.type = option.type
			this.message()
		},
		methods: {
			async message(){
				const system = await this.GQL({
						"operationName": "allSlUserMessages",
						"query": "query allSlUserMessages($filter: SlUserMessageFilter) { allSlUserMessages(filter:$filter) { nodes { createtime id message type uid } } }",
						"variables": {"filter": {"uid":{"equalTo":this.userData.uid},"type":{"equalTo":this.type}}}
				})
				
				if(system.data.allSlUserMessages.nodes !=''){
					
					this.list =system.data.allSlUserMessages.nodes
				}
				//获取用户
				
				
				
				
			},
		
		}
	}
</script>

<style lang="scss">
	.u-page{
		background-color: #FBFCFE;
	}
	 .header{
	 	width: 100%;
	 	height: 260px;
	 	/* color: #FFFFFF; */
		background: linear-gradient(#C7171E, #f0f2f5); /* 标准的语法 */
	 	
	 }
	 .content{
		 position: relative;
		 margin: 15px;
		 background-color: #FFFFFF;
		 min-height: 500px;
		 border-radius: 10px;
		 top: -260px;
	
	 }
	 .message{
		 padding: 15px;
		 
		 .title{
			 font-size: 15px;
			 font-family: PingFangSC-Regular, PingFang SC;
			 font-weight: 400;
			 color: #161E3E;
			 line-height: 16px;
		 }
		 .time{
			 margin-top: -15px;
			 text-align: right;
			 font-size: 10px;
			 font-family: PingFangSC-Regular, PingFang SC;
			 font-weight: 400;
			 color: #9BA7C1;
			 line-height: 16px;
		 }
		 .post{
			 padding-top: 10px;
			 font-size: 12px;
			 font-family: PingFangSC-Regular, PingFang SC;
			 font-weight: 400;
			 color: #767B8D;
			 line-height: 17px;
		 }
	 }

</style>
